Skip to content

Conversation

ImChill1n
Copy link

@ImChill1n ImChill1n commented Sep 14, 2025

Summary

Adds Role.is_gradient and Role.is_holographic properties based on Discord's role styling behavior.

According to the API:

  • Roles with only primary_color are basic, without styling.

  • Adding secondary_color makes the role a gradient.

  • Adding tertiary_color turns it into a holographic style.

These properties check role style and reflect official Discord API behavior.

Checklist

  • If code changes were made, then they have been tested
    • I have updated the documentation to reflect the changes
    • I have formatted the code properly by running pdm lint
    • I have type-checked the code by running pdm pyright
  • This PR fixes an issue
  • This PR adds something new (e.g. new method or parameters)
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@shiftinv shiftinv added the t: enhancement New feature label Sep 14, 2025
@shiftinv shiftinv added this to disnake Sep 14, 2025
@github-project-automation github-project-automation bot moved this to Todo in disnake Sep 14, 2025
@shiftinv shiftinv added this to the disnake v2.12 milestone Sep 14, 2025
@ImChill1n
Copy link
Author

Noticed the CI is flagging issues from files I haven’t touched. Looks like some type checks are running across the whole repo. My changes passed the relevant tests and are isolated to role.py.

Copy link
Member

@onerandomusername onerandomusername left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what happened, but somehow you had the entire repository copied within itself, and that's why tests and checks were failing. I've reverted the commits that cloned the entire repository, let me know if there's anything I can help with.

ImChill1n and others added 4 commits September 15, 2025 09:17
Co-authored-by: Eneg <[email protected]>
Signed-off-by: ImChill1n <[email protected]>
Co-authored-by: Eneg <[email protected]>
Signed-off-by: ImChill1n <[email protected]>
Co-authored-by: Eneg <[email protected]>
Signed-off-by: ImChill1n <[email protected]>
This really fits better.

Co-authored-by: Eneg <[email protected]>
Signed-off-by: ImChill1n <[email protected]>
@github-project-automation github-project-automation bot moved this from Todo to In Progress in disnake Sep 15, 2025
@ImChill1n ImChill1n requested a review from Snipy7374 September 15, 2025 08:05
@ImChill1n
Copy link
Author

I have removed both methods and replaced with enum and style, now distinguishing custom and holographic gradient.

Copy link
Collaborator

@Snipy7374 Snipy7374 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not consistent with the library, there's no need to introduce a new enum just for this. We usually add new enums for literal values coming from the discord API.

@ImChill1n
Copy link
Author

Reverted Enum changes, I have added 2 methods back. I think current version should be good.

@ImChill1n ImChill1n requested a review from Snipy7374 September 18, 2025 16:35
Comment on lines +369 to +371
def has_custom_gradient(self) -> bool:
"""
Whether the role has custom gradient.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know about using the word "custom" here, it implies the existence of non-custom gradient

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t: enhancement New feature

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

5 participants